import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;
import javax.swing.JFrame;
import info.monitorenter.gui.chart.Chart2D;
import info.monitorenter.gui.chart.IAxis.AxisTitle;
import info.monitorenter.gui.chart.ITrace2D;
import info.monitorenter.gui.chart.traces.Trace2DSimple;

public class MinimalStaticChart {

	private MinimalStaticChart() {
	    super();
	  }
	
	public static void main(String[] args) {
		// Create a chart:  
	    Chart2D chart = new Chart2D();
	    chart.getAxisX().setAxisTitle(new AxisTitle("X"));
	    chart.getAxisY().setAxisTitle(new AxisTitle("Y"));
	    // Create an ITrace: 
	    ITrace2D trace = new Trace2DSimple(); 
	    // Add the trace to the chart. This has to be done before adding points (deadlock prevention): 
	    chart.addTrace(trace);
	    // Add all points, as it is static: 
	    Random random = new Random();
	    for(int i=1;i<=365;i++){
	      trace.addPoint(i,random.nextDouble()*10.0+i);
	    }
	    // Make it visible:
	    // Create a frame.
	    JFrame frame = new JFrame("MinimalStaticChart");
	    // add the chart to the frame: 
	    frame.getContentPane().add(chart);
	    frame.setSize(400,300);
	    frame.addWindowListener(
	            new WindowAdapter(){
	              public void windowClosing(WindowEvent e){
	                  System.exit(0);
	              }
	            }
	          );
	        frame.setVisible(true);

	}

}
